// @ts-ignore
/* eslint-disable */
import request from '@/request'

/** createImageTask POST /api/image/createImageSynthesisTask */
export async function createImageTaskUsingPost(
  body: API.CreateImageTaskRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseCreateImageSynthesisTaskResponse_>(
    '/api/image/createImageSynthesisTask',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    }
  )
}

/** deleteImage POST /api/image/delete */
export async function deleteImageUsingPost(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deleteImageUsingPOSTParams,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>('/api/image/delete', {
    method: 'POST',
    params: {
      ...params,
    },
    ...(options || {}),
  })
}

/** editImage POST /api/image/edit */
export async function editImageUsingPost(
  body: API.ImageEditRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>('/api/image/edit', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** getImageById POST /api/image/get */
export async function getImageByIdUsingPost(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getImageByIdUsingPOSTParams,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseImage_>('/api/image/get', {
    method: 'POST',
    params: {
      ...params,
    },
    ...(options || {}),
  })
}

/** getImageVOById POST /api/image/get/vo */
export async function getImageVoByIdUsingPost(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getImageVOByIdUsingPOSTParams,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseImageVO_>('/api/image/get/vo', {
    method: 'POST',
    params: {
      ...params,
    },
    ...(options || {}),
  })
}

/** getImageTask GET /api/image/getImageSynthesisTask */
export async function getImageTaskUsingGet(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getImageTaskUsingGETParams,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseGetImageSynthesisTaskResponse_>(
    '/api/image/getImageSynthesisTask',
    {
      method: 'GET',
      params: {
        ...params,
      },
      ...(options || {}),
    }
  )
}

/** listImageByPage POST /api/image/list/page */
export async function listImageByPageUsingPost(
  body: API.ImageQueryRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponsePageImage_>('/api/image/list/page', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** listImageVOByPage POST /api/image/list/page/vo */
export async function listImageVoByPageUsingPost(
  body: API.ImageQueryRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponsePageImageVO_>('/api/image/list/page/vo', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** listImageTagCategory GET /api/image/list/tagCategory */
export async function listImageTagCategoryUsingGet(options?: { [key: string]: any }) {
  return request<API.BaseResponseImageTagCategoryVO_>('/api/image/list/tagCategory', {
    method: 'GET',
    ...(options || {}),
  })
}

/** reviewImage POST /api/image/review */
export async function reviewImageUsingPost(
  body: API.ImageReviewRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>('/api/image/review', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** searchImage POST /api/image/search */
export async function searchImageUsingPost(
  body: API.ImageSearchRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseListImageSearchResultVO_>('/api/image/search', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** updateImage POST /api/image/update */
export async function updateImageUsingPost(
  body: API.ImageUpdateRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>('/api/image/update', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** uploadImage POST /api/image/upload */
export async function uploadImageUsingPost(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.uploadImageUsingPOSTParams,
  body: {},
  multipartFile?: File,
  options?: { [key: string]: any }
) {
  const formData = new FormData()

  if (multipartFile) {
    formData.append('multipartFile', multipartFile)
  }

  Object.keys(body).forEach((ele) => {
    const item = (body as any)[ele]

    if (item !== undefined && item !== null) {
      if (typeof item === 'object' && !(item instanceof File)) {
        if (item instanceof Array) {
          item.forEach((f) => formData.append(ele, f || ''))
        } else {
          formData.append(ele, JSON.stringify(item))
        }
      } else {
        formData.append(ele, item)
      }
    }
  })

  return request<API.BaseResponseImageVO_>('/api/image/upload', {
    method: 'POST',
    params: {
      ...params,
    },
    data: formData,
    requestType: 'form',
    ...(options || {}),
  })
}

/** uploadImageByBatch POST /api/image/upload/batch */
export async function uploadImageByBatchUsingPost(
  body: API.ImageUploadByBatchRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseInt_>('/api/image/upload/batch', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** uploadImageByUrl POST /api/image/upload/url */
export async function uploadImageByUrlUsingPost(
  body: API.ImageUploadRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseImageVO_>('/api/image/upload/url', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}
